package com.book.xsp.bookparent.controller;


import com.book.xsp.bookparent.config.R;
import com.book.xsp.bookparent.entity.vo.StudentScoreVo;
import com.book.xsp.bookparent.service.IStudentScoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author snake_skin
 * @since 2023-11-29
 */
@RestController
@RequestMapping("/student-score")
@CrossOrigin
@Slf4j
public class StudentScoreController {

    @Resource
    IStudentScoreService iStudentScoreService;

    @GetMapping
    public R getAllStudentScore() {
        List<StudentScoreVo> studentScoreVoList = iStudentScoreService.getAllStudentService();

        return R.ok().data("list",studentScoreVoList);
    }

    @PostMapping
    public R addStudentScore(@RequestBody StudentScoreVo studentScoreVo) {
        boolean b = iStudentScoreService.addStudentScore(studentScoreVo);
        return R.ok().success(b);
    }

}
